Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Secret Decoder Ring #1265

Merged
merged 136 commits into from
Dec 7, 2018
Merged

Secret Decoder Ring #1265

merged 136 commits into from
Dec 7, 2018

Conversation

mikeseese
Copy link
Contributor

@mikeseese mikeseese commented Sep 11, 2018

@seesemichaelj's notes:

This PR is currently a WIP, and more details will be added later. However, in the meantime, the gist is below:

  • Add a module/library for easy-to-use decoding for TruffleContract object's
    • Get the contract state variables at a certain block
    • Get all of the occurrences of an event type during a certain block, including the decoded arguments
    • Subscribe to an event type being emitted
    • Decode a transaction to a contract (function and arguments)
  • Add capability for decoding variables given an EVM state (stack, memory, storage, etc.) to allow the decoding functionality to be removed from truffle-debugger
  • Use TypeScript to try to type as much as possible

@gnidan addendum:

  • Besides truffle-decoder and truffle-decode-utils, mostly the work herein affects the debugger by way of making decode an async operation.

    The debugger now uses a semaphore to track outstanding decode requests and requires that it resolves before data.current.identifiers.* selectors are available for use. Notably, this adds a new session.variables() method as the canonical means to get the current scope of variables.

  • This also includes a poor excuse for a translation later between the decoder and the debugger, in order exclusively [for now] to convert mappings coming back from the decoder into JS Map objects.

  • Since the decoder returns BNs, and since @seesemichaelj makes a compelling argument against numbers, the debugger no longer cleans BNs, and instead we inject a custom inspect method for BNs for use in the debugger repl context.

  • Continuous Integration now contains a script for bootstrap instead of the inline invocation. This is to account for the decoder and decode utils requiring a tsc build.

  • The decoder in its current form includes a draft for tests in the form of a Truffle project. Much of the decoder logic is covered by the existing decoding integration tests. The decode utils don't have tests right now.

@gnidan gnidan changed the title [WIP] Truffle Decoder Ring [WIP] Secret Decoder Ring Sep 11, 2018
haltman-at and others added 26 commits November 28, 2018 17:38
Also fix array/set mismatch
- Define generic `activate` method for switching repl contexts
- Convert decoder-native mappings into JS Map objects
- Detect uint/int types and represent mapping with BN keys instead
  of JS-normal string keys
(data.current.identifiers.decoded selector)
Strip mapping metadata from decoder output in debugger
@gnidan
Copy link
Contributor

gnidan commented Dec 7, 2018

This has been hammer-tested significantly.

There are outstanding problems with decoding, mostly in the form of unsupported data types, or broken data types. At this point, none of the issues are regressions, but it's unclear whether the underlying brokenness is the same.

Merging now before it gets any bigger.

@gnidan gnidan merged commit e18a4e9 into next Dec 7, 2018
@gnidan gnidan deleted the truffle-decoder branch December 7, 2018 03:05
@gnidan
Copy link
Contributor

gnidan commented Dec 7, 2018

@seesemichaelj thank you for getting these new packages going. exciting days ahead as they mature!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants